package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TXsqk;
import com.ruoyi.system.service.ITXsqkService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 主办的国际学术期刊 Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/xsqk")
public class TXsqkController extends BaseController
{
    @Autowired
    private ITXsqkService tXsqkService;

    /**
     * 查询主办的国际学术期刊 列表
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:list')")
    @GetMapping("/list")
    public TableDataInfo list(TXsqk tXsqk)
    {
        startPage();
        List<TXsqk> list = tXsqkService.selectTXsqkList(tXsqk);
        return getDataTable(list);
    }

    /**
     * 导出主办的国际学术期刊 列表
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:export')")
    @Log(title = "主办的国际学术期刊 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TXsqk tXsqk)
    {
        List<TXsqk> list = tXsqkService.selectTXsqkList(tXsqk);
        ExcelUtil<TXsqk> util = new ExcelUtil<TXsqk>(TXsqk.class);
        util.exportExcel(response, list, "主办的国际学术期刊 数据");
    }

    /**
     * 获取主办的国际学术期刊 详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tXsqkService.selectTXsqkById(id));
    }

    /**
     * 新增主办的国际学术期刊 
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:add')")
    @Log(title = "主办的国际学术期刊 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TXsqk tXsqk)
    {
        return toAjax(tXsqkService.insertTXsqk(tXsqk));
    }

    /**
     * 修改主办的国际学术期刊 
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:edit')")
    @Log(title = "主办的国际学术期刊 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TXsqk tXsqk)
    {
        return toAjax(tXsqkService.updateTXsqk(tXsqk));
    }

    /**
     * 删除主办的国际学术期刊 
     */
    @PreAuthorize("@ss.hasPermi('system:xsqk:remove')")
    @Log(title = "主办的国际学术期刊 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tXsqkService.deleteTXsqkByIds(ids));
    }
}
